<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row_list.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Illustrate')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-illustrate" data-rule="required" class="form-control" name="row[illustrate]" type="text" value="{$row_list.illustrate|htmlentities}">
        </div>
    </div>
    <!--<div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lifespan_data')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
            {foreach name="lifespanDataList" item="vo"}
            <label for="row[lifespan_data]-{$key}"><input id="row[lifespan_data]-{$key}" name="row[lifespan_data]" type="radio" value="{$key}" {in name="key" value="$row_list.lifespan_data"}checked{/in} /> {$vo}</label>
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group" data-favisible="lifespan_data=0">
        <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row_list.start_time?datetime($row_list.start_time):''}">
        </div>
    </div>
    <div class="form-group" data-favisible="lifespan_data=0">
        <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row_list.end_time?datetime($row_list.end_time):''}">
        </div>
    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Fate')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-fate" class="form-control" name="row[fate]" type="number" value="{$row_list.fate|htmlentities}">
        </div>
    </div>
    <div class="form-group" data-favisible="lifespan_data=1">
        <label class="control-label col-xs-12 col-sm-2">{:__('Online_switch')}:</label>
        <div class="col-xs-12 col-sm-8">

            <input type="hidden" name="row[online_switch]" id="c-state-online_switch" class="form-control" style="width:50px" value="{$row_list.online_switch}" placeholder="状态"/>
            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-state-online_switch" data-yes="1" data-no="0" >
                <i class="fa fa-toggle-on text-success {if $row_list.online_switch==0}fa-flip-horizontal text-gray{/if} fa-2x"></i>
            </a>

        </div>
    </div>

    <style>
        .padd{
            padding-left: 20px;
            padding-right: 15px;
        }
        .cost_span{
            color: red;
        }
    </style>
    <div class="form-group padd" style="margin: 0 auto">
        <div class="form-group row padd">
            <label class="col-xs-12">{:__('卡券类型')}:</label>
            <div class="form-group">
                <label class=" col-xs-4 col-sm-2">
                    <span class="cost_span all_cost" style="line-height: 30px;">核算总成本：{$row_list.all_cost}</span>
                    <span class="cost_span all_price">总价格：</span>
                </label>
                <div class="col-xs-4 col-sm-4" style="padding-left: 0">
                    <input id="c-all_price" class="form-control" data-rule="required;range(0.01~)" min="0.01"  name="row[all_price]" type="number" value="{$row_list.all_price}">

                </div>
            </div>
        </div>
    </div>
    <div class="form-group">

        <div class="col-xs-12">
            <table class="table fieldlist" data-template="eventtpl" data-name="row[event]" id="second-table">
                <tr>
                    <td>{:__('类型')}</td>
                    <td>{:__('次数')}</td>
                    <td>{:__('单次价格')}</td>
                    <td class="cost_span">{:__('核算总成本')}</td>
                    <!--<td>{:__('总价格')}</td>-->
                    <td width="100"></td>
                </tr>
                <tr>
                    <td colspan="4"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
                </tr>
            </table>

            <!--请注意实际开发中textarea应该添加个hidden进行隐藏-->
            <textarea name="row[event]" class="form-control hidden all_data" cols="30" rows="5">{$row_list.event}</textarea>
            <script id="eventtpl" type="text/html">
                <tr class="form-inline">
                    <td>
                        <select data-rule="required" data-id="<%=index%>" class="form-control selectpicker card_type" name="<%=name%>[<%=index%>][card_type_id]">
                            {foreach name="typeList" item="vo"}
                            <% var selected_status = row.selected_status; %>
                            <% var id = {$vo.id}; %>
                            <option value="{$vo.id}" data-price="{$vo.price}" data-id="<%=index%>"
                            <% if (row.card_type_id==id && selected_status==1) { %> selected <% } %>
                             >{$vo.name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="hidden" value="<%=row.id%>"  name="<%=name%>[<%=index%>][id]">
                        <input type="number" name="<%=name%>[<%=index%>][number]" class="form-control number_class" min="1"data-rule="required;range(1~)" data-id="<%=index%>" value="<%=row.number%>" placeholder="次数"/></td>
                    <td>
                        <input type="number" id="number_<%=index%>" name="<%=name%>[<%=index%>][price]" readonly class="form-control price_class" min="0.01"
                        data-rule="required;range(0.01~)" data-id="<%=index%>" value="{$typeList[0]['price']}" placeholder="单次价格"/></td>
                    <td class="cost_span" style="vertical-align: inherit;"><span id="all_cost_<%=index%>"><%=row.all_cost%></span></td>
                    <!--<td><input type="number" name="<%=name%>[<%=index%>][all_price]" class="form-control all_price_class"min="0.01" value="<%=row.all_price%>" placeholder="总价格"/></td>
                    -->
                    <td>
                        <!--下面的两个按钮务必保留-->
                        <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                        <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                    </td>
                </tr>
            </script>
        </div>
    </div>
<!--    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('All_cost')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-all_cost" data-rule="required" class="form-control" step="0.01" name="row[all_cost]" type="number" value="{$row_list.all_cost|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('All_price')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-all_price" data-rule="required" class="form-control" step="0.01" name="row[all_price]" type="number" value="{$row_list.all_price|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row_list.status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>-->
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
